import { lazy,Component } from 'react'
import { Navigate, Outlet } from 'react-router-dom'
import {
    DesktopOutlined,
    FileOutlined,
    PieChartOutlined,
    TeamOutlined,
    UserOutlined,
    FolderAddOutlined
} from '@ant-design/icons';

import Login from '@/views/login/Login'

const routes = {
    slide_router: [
        {
            path: '/',
            element: <Navigate to="/afeng/home" />,
        },
        {
            path: '/afeng',
            element: <Outlet />,
            children: [
                {
                    path:'',
                    element: <Navigate  to="home" />
                 },
                {
                    path: 'home',
                    Component: lazy(() => import('@/component/slide/home/Home')),
                    label:'首页',
                    icon:<PieChartOutlined />
                },
                {
                    path: 'user_control',
                    element: <Outlet /> ,
                    label:'用户管理',
                    icon: <DesktopOutlined />,
                    children: [
                        // {
                        //     path:"",
                        //     element: <Navigate to="userlist" /> ,
                        // },
                        {
                            path: 'userlist',
                            Component: lazy(() => import('@/component/slide/user_control/UserList')),
                            label:'用户列表',
                            key:'user_control/userlist'
                        }
                    ]
                },
                {
                    path:'authority_management',
                    element:  <Outlet /> ,
                    label:'权限管理',
                    icon: <UserOutlined />,
                    children: [
                        // {
                        //     path:"",
                        //     element: <Navigate to="action_list" /> ,
                        // },
                        {
                            path:'action_list',
                            Component: lazy(() => import('@/component/slide/authority_management/Action_list')),
                            label:'角色列表',
                        },
                        {
                            path:'jurisdiction_list',
                            Component: lazy(() => import('@/component/slide/authority_management/Jurisdiction_list')),
                            label:'权限列表',
                        },
                        {
                            path:'update_action',
                            Component: lazy(() => import('@/component/slide/authority_management/UpdateAction')),
                            label:'修改角色'
                        }
                    ]
                },
                {
                    path: 'news_management',
                    label:'新闻管理',
                    icon: <TeamOutlined />,
                    element: <Outlet />,
                    children:[
                        {
                            path:'news_list',
                            Component: lazy(() => import('@/component/slide/news/NewList')),
                            label: '新闻列表'
                        },
                        {
                            path:'write_news',
                            Component: lazy(() => import('@/component/slide/news/WriteNews')),
                            label: '撰写新闻'
                        },
                        {
                            path:'news_update',
                            Component: lazy(() => import('@/component/slide/news/NewsUpdate')),
                            label: '新闻更新'
                        },
                        {
                            path:'news_prev',
                            Component: lazy(() => import('@/component/slide/news/NewsClassify')),
                            label: '新闻预览'
                        },
                        {
                            path:'news_classify',
                            Component: lazy(() => import('@/component/slide/news/NewsPrev')),
                            label: '新闻分类'
                        },
                        {
                            path:'drafts',
                            Component: lazy(() => import('@/component/slide/news/Drafts')),
                            label: '草稿箱'
                        },
                    ]
                },
                {
                    path: 'auditlist',
                    label:'审核管理',
                    icon: <FileOutlined />,
                    element: <Outlet />,
                    children:[
                        {
                            path:'censor_news',
                            Component: lazy(() => import('@/component/slide/audit/CensorNews')),
                            label: '审核新闻'
                        },
                        {
                            path:'censor_list',
                            Component: lazy(() => import('@/component/slide/audit/CensorList')),
                            label: '审核列表'
                        },
                    ]
                },
                {
                    path: 'publish',
                    label:'发布管理',
                    icon:  <FolderAddOutlined />,
                    element: <Outlet />,
                    children:[
                        {
                            path:'release',
                            Component: lazy(() => import('@/component/slide/publish/Release')),
                            label: '待发布'
                        },
                        {
                            path:'publish',
                            Component: lazy(() => import('@/component/slide/publish/Published')),
                            label: '已发布'
                        },
                        {
                            path:'offline',
                            Component: lazy(() => import('@/component/slide/publish/Offline')),
                            label: '已下线'
                        },
                    ]
                },
            ],
        },
        {
            path: '*',
            element: <Navigate to="/afeng/home" />,
        }

    ],
    loginRouter: [
        {
            path:'/',
            element: <Navigate to="/login" />
        },
        {
            path:'/login',
            element: <Login />
        },
        {
            path:'*',
            element: <Navigate to="/login" />
        }
    ]
}

export const { slide_router,loginRouter } = routes

export default routes